package com.lieve.servicea.annotation;

import feign.MethodMetadata;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.support.SpringMvcContract;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

/**
 * @author sunlijiang
 * @date 2020/3/24
 */
@Slf4j
public class LieveContract extends SpringMvcContract {

    @Override
    protected void processAnnotationOnMethod(MethodMetadata data, Annotation methodAnnotation, Method method) {
        super.processAnnotationOnMethod(data, methodAnnotation, method);
        log.info("EnabledFeignLog.class : {}", EnabledFeignLog.class.getSimpleName());
        if (EnabledFeignLog.class.isInstance(methodAnnotation)) {
            EnabledFeignLog enabledFeignLog = method.getAnnotation(EnabledFeignLog.class);
            String url = enabledFeignLog.url();
            // String method = enabledFeignLog.method();
            // data.template().method(method);
            // data.template().append(url);
        }
    }
}
